#include <iostream>

using namespace std;

int factorial( int n );

int main() {
    long double result = 1.0;
    int accuracy, x;

    cout << "Please enter the accuracy : ";
    cin >> accuracy;

    cout << "Please enter x: ";
    cin >> x;

    while (accuracy > 0) {
        int n = accuracy;
        int original = x;
        while (n-- > 1) {
            x *= original;
        }
        result += static_cast<double>(x)/factorial(accuracy);
        x = original;
        accuracy--;
    }

    cout << "The e^x is " << result;

    return 0;
}

int factorial( int n ) {
    if (n == 0) return 1;
    return n * factorial(n - 1);
}
